package com.mes.schedule.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert=false,dynamicUpdate=false)
@Table(name = "T_SCHEDULE_OPERATION")
@BatchSize(size=20)
@Lazy(value=true)
public class ScheduleOperationRecord extends BasicModel implements Serializable {
	private static final long serialVersionUID = 1L;
	
	/**
	 *  添加协作工序	
	 */
	public final static String EVENTTYPE_PUBLISH_COTASK = "PUBLISH_COTASK"; 
	/**
	 *  未添加协作工序
	 */	
	public final static String EVENTTYPE_UNPUBLISH_COTASK = "UNPUBLISH_COTASK"; 	
	/**
	 *   接收协作工序		
	 */	
	public final static String EVENTTYPE_RECEIVE_COTASK = "RECEIVE_COTASK"; 
	/**
	 *  拒绝协作工序		
	 */	
	public final static String EVENTTYPE_REFUSE_COTASK = "REFUSE_COTASK"; 
	/**
	 *  反馈协作工序状态	
	 */	
	public final static String EVENTTYPE_FEEDBACK_COTASK = "FEEDBACK_COTASK"; 		
	/**
	 *  交货期更改		
	 */	
	public final static String EVENTTYPE_LATEFINISHCHANGE = "LATEFINISHCHANGE"; 	
	/**
	 *  调度当前事件变更		
	 */	
	public final static String EVENTTYPE_SCHEDULECURRENTTIMECHANGE = "SCHEDULECURRENTTIMECHANGE"; 	
	/**
	 *  零件任务计划信息	
	 */	
	public final static String EVENTTYPE_PARTTASK_PLANINFO = "PARTTASK_PLANINFO"; 	
	/**
	 *  新增零件任务	
	 */	
	public final static String EVENTTYPE_PARTTASK_ADD = "PARTTASK_ADD"; 	
	/**
	 *  删除零件任务	
	 */	
	public final static String EVENTTYPE_PARTTASK_DELETE = "PARTTASK_DELETE"; 	
	
	/**
	 * 工序任务计划信息
	 */
	public final static String EVENTTYPE_OPERATIONTASK_PLANINFO = "OPERATIONTASK_PLANINFO"; 	
	/**
	 * 新增工序任务
	 */
	public final static String EVENTTYPE_OPERATIONTASK_ADD = "OPERATIONTASK_ADD"; 
	/**
	 * 删除工序任务
	 */
	public final static String EVENTTYPE_OPERATIONTASK_DELETE = "OPERATIONTASK_DELETE"; 
 
	/**
	 *  锁定任务	
	 */	
	public final static String EVENTTYPE_LOCK_TASK = "LOCK_TASK"; 	
	/**
	 *  设备开始维护
	 */		
	public final static String EVENTTYPE_DEVICE_BEGINMAINT = "DEVICE_BEGINMAINT"; 	
	/**
	 *  设备维护结束	
	 */	
	public final static String EVENTTYPE_DEVICE_RESUMEMAINT = "DEVICE_RESUMEMAINT"; 		
			
	
	/**
	 *  准备任务开始	
	 */	
	public final static String EVENTTYPE_PREPARETASK_START = "PrepareTaskStart"; 		
	/**
	 *  准备结束
	 */	
	public final static String EVENTTYPE_PREPARETASK_FINISH = "PrepareTaskFinish"; 	
	/**
	 *  准备异常	
	 */	
	public final static String EVENTTYPE_PREPARETASK_EXCEPTION = "PrepareTaskException"; 	

	/**
	 * 来自于调度外面的任务派工事件，需要与调度系统同步
	 */
	public final static String EVENTTYPE_DISPATCH_TASK = "DISPATCH_TASK"; 	
	/**
	 *  // 添加进度反馈信息	
	 */	
	public final static String EVENTTYPE_ADD_FEEDBACK = "ADD_FEEDBACK"; 
	
	/**
	 *  零部件分批信息	
	 */
	
	public final static String EVENTTYPE_PARTTASK_SPLITBATCH = "PARTTASK_SPLITBATCH"; 	
	
	/**
	 * 零件取消分批信息
	 */
	public final static String EVENTTYPE_PARTTASK_CANCELSPLITBATCH = "PARTTASK_CANCELSPLITBATCH"; 	
	
	
	/**
	 *  零部件合批信息	
	 */
	
	public final static String EVENTTYPE_PARTTASK_COMBINEBATCH = "PARTTASK_COMBINEBATCH"; 		
	

	/**
	 *  零部件取消虚合批信息	
	 */
	
	public final static String EVENTTYPE_PARTTASK_CANCELCOMBINEBATCH = "PARTTASK_CANCELCOMBINEBATCH"; 
	/**
	 * 工序任务合批
	 */
	
	public final static String EVENTTYPE_OPERATIONTASK_GROUP = "OPERATIONTASK_GROUP"; 
	
	/**
	 * 工序任务取消合批
	 */
	
	public final static String EVENTTYPE_OPERATIONTASK_CANCELGROUP = "OPERATIONTASK_CANCELGROUP"; 

	
	
	/**
	 *  草稿
	 */		
	public final static int EVENTSTATE_DRAFT = 1; 		
	/**
	 *  // 成功		
	 */	
	public final static int EVENTSTATE_SUCCESS = 2; 
	/**
	 *  // 失败		
	 */	
	public final static int EVENTSTATE_FAILURE = 3;
	
	
	/**
	 *  唯一号		
	 */
	@Id
	@GenericGenerator(name="scheduleOperationUid", strategy="assigned")
	@Column(name = "UNIQUEID")
	private String scheduleOperationUid;
	/**
	 * 	应该处理该事件的调度方案唯一号	
	 */	
	@Column(name = "SCHEDULEUID")
	private String scheduleUid;
	/**
	 * 	事件类型	
	 */		
	@Column(name = "EVENT_TYPE")
	private String eventType;
	/**
	 * 	关键实体维一号	
	 */		
	@Column(name = "KEY_UID")
	private String 	keyUid;

	/**
	 * 	事件描述,可读	
	 */		
	@Column(name = "EVENT_DESC")
	private String eventDesc;
	/**
	 * 	事件状态，0-未处理，1-处理成功，2-处理失败	
	 */	
	
	
	/**
	 * 图号
	 */
	@Column(name = "DRAWINGID")
	private String drawingId;
	
	/**
	 * 批次
	 */
	@Column(name = "BATCHNUM")
	private String batchNum;
	
	/**
	 * 工序
	 */
	@Column(name = "OPERATIONIDDESC")
	private String operationIdDesc;
	
	@Column(name = "PLANQTY")
	private String planQty;

	/**
	 * 父操作uid
	 */
	@Column(name = "PARENTUID")
	private String parentUid;
	
	@Column(name = "EVENT_STATE")
	private int eventState;

	/**
	 * 	事件来源实体唯一号
	 */	
	@Column(name = "SOURCE_UID")
	private String sourceUid;
	
	/**
	 * 	事件来源实体类型
	 */		
	@Column(name = "SOURCE_TYPE")
	private String sourceType;	
	
	/**
	 * 	事件来源实体类型	
	 */		
	private Integer eventProState;		
	
	/**
	 * 	事件处理者	
	 */		
	@Column(name = "SCHEDULEOPERATION_HANDLER")
	private String scheduleOperation_handler;
	/**
	 * 	事件处理时间 	
	 */		
	@Column(name = "HANDLETIME")
	private Date handleTime;
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getScheduleOperationUid();
	}
	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setScheduleOperationUid(uuid);
	}

	public String getScheduleUid() {
		return scheduleUid;
	}

	public String getEventType() {
		return eventType;
	}

	public String getKeyUid() {
		return keyUid;
	}



	public int getEventState() {
		return eventState;
	}

	public String getSourceUid() {
		return sourceUid;
	}

	public String getSourceType() {
		return sourceType;
	}

	public String getScheduleOperation_handler() {
		return scheduleOperation_handler;
	}

	public Date getHandleTime() {
		return handleTime;
	}


	public void setScheduleUid(String scheduleUid) {
		this.scheduleUid = scheduleUid;
	}

	public void setEventType(String eventType) {
		this.eventType = eventType;
	}

	public void setKeyUid(String keyUid) {
		this.keyUid = keyUid;
	}


	public void setEventState(int eventState) {
		this.eventState = eventState;
	}

	public void setSourceUid(String sourceUid) {
		this.sourceUid = sourceUid;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}

	public void setScheduleOperation_handler(String scheduleOperation_handler) {
		this.scheduleOperation_handler = scheduleOperation_handler;
	}

	public void setHandleTime(Date handleTime) {
		this.handleTime = handleTime;
	}

	public String getEventDesc() {
		return eventDesc;
	}

	public void setEventDesc(String eventDesc) {
		this.eventDesc = eventDesc;
	}

	public Integer getEventProState() {
		return eventProState;
	}

	public void setEventProState(Integer eventProState) {
		this.eventProState = eventProState;
	}

	public String getDrawingId() {
		return drawingId;
	}

	public void setDrawingId(String drawingId) {
		this.drawingId = drawingId;
	}

	public String getBatchNum() {
		return batchNum;
	}

	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}

	public String getOperationIdDesc() {
		return operationIdDesc;
	}

	public void setOperationIdDesc(String operationIdDesc) {
		this.operationIdDesc = operationIdDesc;
	}

	public String getParentUid() {
		return parentUid;
	}

	public void setParentUid(String parentUid) {
		this.parentUid = parentUid;
	}

	public String getScheduleOperationUid() {
		return scheduleOperationUid;
	}

	public void setScheduleOperationUid(String scheduleOperationUid) {
		this.scheduleOperationUid = scheduleOperationUid;
	}

	public String getPlanQty() {
		return planQty;
	}

	public void setPlanQty(String planQty) {
		this.planQty = planQty;
	}	

}
